/*

Implement a Queue class that can output the messages shown in the following program’s comments, where a queue is a First In, First Out list of zero or more elements. 
（Do not change main() in any way）
int main()  {
      Queue q;
 
       --q;                                  // Display：The queue is empty!
       q = q + 5 + 6 + 3;
       cout << q;                      // Display：5   6   3 
       cout << --q << endl;      // Display：5 
       cout << q;                      // Display：6   3 
       q = 9 + q;
       cout << q;                      // Display：6   3   9
       q = 2 + q;                      // Display：The queue is full! 
       cout << q;                     // Display：6   3   9 
       return 0;
}

*/
#include <iostream>
using namespace std;

class Queue{
private:
    static const int Capacity = 3;
    int data[Capacity];
    int n;
public:
    Queue():n(0){};
    ~Queue(){};

    void operator=(const Queue&);
    int operator--();

    friend Queue operator+(Queue, int);
    friend Queue& operator+(int,Queue);
    friend ostream& operator<<(ostream&,const Queue&);
};

void Queue::operator=(const Queue&Q){
    n=Q.n;
    for(int i =0;i<Q.n;i++){
        data[i]=Q.data[i];
    }
    
}

int Queue::operator--(){
    if(n==0){
        cout<<"The queue is empty!"<<endl;
        return -1;
    }
    else{
        int returnInt = data[0];
        for(int i=0;i<n;i++){
            data[i]=data[i+1];
        }
        n--;
        return returnInt;
    }
}

Queue operator+(Queue& Q, int Elem){
    if(Q.n==Q.Capacity){
        cout<<"The queue is full! "<<endl;
        return Q;
    }
    else{
        Q.data[Q.n]=Elem;
        Q.n++;
        return Q;
    }
}
Queue& operator+(int Elem,Queue Q){
    return Q+Elem;
}
ostream& operator<<(ostream& oo,const Queue& Q){
    for(int i =0;i<Q.n;i++){
        oo<<Q.data[i]<<" ";
    }
    oo<<endl;
    return oo;
}

int main()  {
    Queue q;
    --q;                                  // Display：The queue is empty!
    q = q + 5 + 6 + 3;
    cout << q;                      // Display：5   6   3 
    cout << --q << endl;      // Display：5 
    cout << q;                      // Display：6   3 
    q = 9 + q;
    cout << q;                      // Display：6   3   9
    q = 2 + q;                      // Display：The queue is full! 
    cout << q;                     // Display：6   3   9 
    return 0;
}